/**
 * @Project: InteractAPI
 * @Title: Area_PlayArea_Action_ender.java
 * @Package com.j99view.interact.action.area
 * @Description: TODO
 * Copyright: Copyright (c) 2010 
 * Company:ENDER.crop
 * 
 * @author ender
 * @date 2013-8-29 下午11:04:16
 * @version V1.0.0
 */
package com.j99view.interact.action.area;

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

import com.j99view.interact.InteractStruct;
import com.j99view.interact.action.InteractAction_ender;

/**
 * @ClassName: Area_PlayArea_Action_ender
 * @Description: TODO
 * @author ender
 * @date 2013-8-29 下午11:04:16
 *
 */
public class Area_PlayArea_Action_ender extends InteractAction_ender {
	/**
	 * 播放指定的区
	 */
	public static final int ID_AREA_PLAY_AREA_ACTION = 3007;
	public static final String DESCRIPTION  = "播放指定的区";
	
	private int areaNo = 0;
	
	/**
	
	  * 创建一个新的实例 Area_PlayArea_Action. 
	  * <p>Title: </p>
	  * <p>Description: </p>
	  */
	public Area_PlayArea_Action_ender(final int areaNo) {
		this.struct.setType(ID_AREA_PLAY_AREA_ACTION);
		this.struct.setSubType(InteractStruct.DEFAULTINT);
		this.areaNo = areaNo;
		this.struct.setValue1(areaNo);
		this.struct.setValue2(InteractStruct.DEFAULTINT);
		this.struct.setValue3(InteractStruct.DEFAULTINT);
		this.struct.setValue4(InteractStruct.DEFAULTINT);
		this.struct.setArgLen(InteractStruct.DEFAULTINT);
		this.struct.setArg(InteractStruct.DEFAULTINT);
	}
	
	/**
	 * 
	  * getAreaNo(get Method)
	  * @author ender
	  * @Title: getAreaNo
	  * @Description: TODO
	  * @param @return    设定文件
	  * @return int    返回类型
	  * @throws
	 */
	public int getAreaNo(){
		return areaNo;
	}
	
	/**
	 * @param areaNo the areaNo to set
	 */
	public void setAreaNo(int areaNo) {
		this.areaNo = areaNo;
		this.struct.setValue1(areaNo);
	}

	/*
	  * <p>Title: write</p>
	  * <p>Description: </p>
	  * @see com.j99view.interact.action.InteractAction_ender#write()
	  */
	@Override
	public void write(Socket socket) throws IOException {
		OutputStream os = socket.getOutputStream();
		BufferedOutputStream bos = new BufferedOutputStream(os);
		bos.write(this.struct.getHead());
		bos.write(this.struct.getSubHead());
		bos.write(this.struct.getType());
		bos.write(this.struct.getSubType());
		bos.write(this.struct.getValue1());
		bos.write(this.struct.getValue2());
		bos.write(this.struct.getValue3());
		bos.write(this.struct.getValue4());
		bos.write(this.struct.getArgLen());
		bos.write(this.struct.getArg());
		bos.flush();
	}
	
}
